<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: gavin
 * Date: 15-3-26
 * Time: 下午4:45
 */
class Ghc_options_model extends CI_Model
{

    public function __construct()
    {
        parent::__construct();
        //装载database
        $this->load->database();
    }

    public function addIndexViews()
    {
        $sql = sprintf("update ghc_options set value = value+1 where bolt like 'indexviews'");
        $this->db->query($sql);
    }

    public function getIndexViews()
    {
        $sql = sprintf("select value from ghc_options where bolt like 'indexviews'");
        $query = $this->db->query($sql);
        return $query->first_row()->value;
    }


}
